package com.ruoyi.recipe.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.recipe.mapper.RecipeDishMealMapper;
import com.ruoyi.recipe.domain.RecipeDishMeal;
import com.ruoyi.recipe.service.IRecipeDishMealService;
import com.ruoyi.common.core.text.Convert;

/**
 * 婴儿辅食Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-10
 */
@Service
public class RecipeDishMealServiceImpl implements IRecipeDishMealService 
{
    @Autowired
    private RecipeDishMealMapper recipeDishMealMapper;

    /**
     * 查询婴儿辅食
     * 
     * @param mealId 婴儿辅食主键
     * @return 婴儿辅食
     */
    @Override
    public RecipeDishMeal selectRecipeDishMealByMealId(Long mealId)
    {
        return recipeDishMealMapper.selectRecipeDishMealByMealId(mealId);
    }

    /**
     * 查询婴儿辅食列表
     * 
     * @param recipeDishMeal 婴儿辅食
     * @return 婴儿辅食
     */
    @Override
    public List<RecipeDishMeal> selectRecipeDishMealList(RecipeDishMeal recipeDishMeal)
    {
        return recipeDishMealMapper.selectRecipeDishMealList(recipeDishMeal);
    }

    /**
     * 新增婴儿辅食
     * 
     * @param recipeDishMeal 婴儿辅食
     * @return 结果
     */
    @Override
    public int insertRecipeDishMeal(RecipeDishMeal recipeDishMeal)
    {
        recipeDishMeal.setCreateTime(DateUtils.getNowDate());
        return recipeDishMealMapper.insertRecipeDishMeal(recipeDishMeal);
    }

    @Override
    public int batchInsertRecipeDishMeal(List<RecipeDishMeal> list) {
        return recipeDishMealMapper.batchInsertRecipeDishMeal(list);
    }

    /**
     * 修改婴儿辅食
     * 
     * @param recipeDishMeal 婴儿辅食
     * @return 结果
     */
    @Override
    public int updateRecipeDishMeal(RecipeDishMeal recipeDishMeal)
    {
        recipeDishMeal.setUpdateTime(DateUtils.getNowDate());
        return recipeDishMealMapper.updateRecipeDishMeal(recipeDishMeal);
    }

    /**
     * 批量删除婴儿辅食
     * 
     * @param mealIds 需要删除的婴儿辅食主键
     * @return 结果
     */
    @Override
    public int deleteRecipeDishMealByMealIds(String mealIds)
    {
        return recipeDishMealMapper.deleteRecipeDishMealByMealIds(Convert.toStrArray(mealIds));
    }

    /**
     * 删除婴儿辅食信息
     * 
     * @param mealId 婴儿辅食主键
     * @return 结果
     */
    @Override
    public int deleteRecipeDishMealByMealId(Long mealId)
    {
        return recipeDishMealMapper.deleteRecipeDishMealByMealId(mealId);
    }

    @Override
    public int deleteRecipeDishMealByDishId(Long dishId) {
        return recipeDishMealMapper.deleteRecipeDishMealByDishId(dishId);
    }

    @Override
    public int deleteRecipeDishMealByDishIds(String[] dishIds) {
        return recipeDishMealMapper.deleteRecipeDishMealByDishIds(dishIds);
    }
}
